<?php
namespace app\admin\validate;

use think\Validate;

class Prison extends Validate
{
    protected $rule = [
        // 'pid' => 'require|integer',
         'name' => 'require',
         'number' => 'require|between:1,120',
        // 'mid' => 'require|integer',
        // 'dirs' => 'require|/^[a-zA-Z0-9\-\_]+$/',
        // 'target' => 'require',
        // 'templist' => 'require|/^[a-zA-Z0-9\_]+$/',
        // 'temparticle' => 'require|/^[a-zA-Z0-9\_]+$/',
        // 'pagesize' => 'require|integer|>=:1',
        // 'sorts' => 'require|integer|>=:1',
        // 'status' => 'require|in:0,1',
    ];

    protected $message = [
        'pid' => '{%pid_val}',
        'name' => '{%name_val}',
        'mid' => '{%mid_val}',
        'dirs.require' => '{%dirs_require}',
        'dirs' => '{%dirs_val}',
        'target' => '{%target_val}',
        'templist' => '{%templist_val}',
        'temparticle' => '{%temparticle_val}',
        'pagesize' => '{%pagesize_val}',
        'sorts' => '{%sorts_val}',
        'status' => '{%status_val}',

        'number.require'=>'{%number_unique}',
        'number.between'=>'{%number_between}',
    ];

    protected $scene = [
         'add'   => ['number', 'name'],
         'edit'  => ['number', 'name'],
        // 'status' => ['status'],
        // 'typename' => ['typename'],
        // 'dirs' => ['dirs'],
    ];
}